
import { Route, Routes } from "react-router-dom"
import routerArr from "./index"
export function createRouter() {
    let arr = routerArr.map((item) => {
        if (item.children) {
            return <Route key={item.path} path={item.path} Component={item.component}>
                {item.children.map((items) => {
                    return <Route key={items.path} path={items.path} Component={items.component}></Route>
                })
                }
            </Route>
        } else {
            return <Route key={item.path} path={item.path} Component={item.component}> </Route>
        }


    })
    return <Routes> {arr} </Routes>

}